<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/button.css">
    <link rel="shortcut icon" href="#">
</head>
<body>
<table>
    <thead>
    <tr>
        <th>ID</th>
        <th>TIME</th>
        <th>USERNAME</th>
        <th>GID</th>
        <th>PRICE</th>
        <th>STATUS</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="order : ${orders}">
        <td th:text="${order.id}"></td>
        <td th:text="${order.time}"></td>
        <td th:text="${order.username}"></td>
        <td th:text="${order.gid}"></td>
        <td th:text="${order.price}"></td>
        <td th:text="${order.status} == 'doing'?'正在处理':'订单已完成'"></td>
        <td>
            <form th:action="@{/order}" th:method="post">
                <input type="hidden" name="_method" value="PATCH">
                <input type="hidden" th:name="id" th:value="${order.id}">
                <input type="hidden" th:name="username" th:value="${order.username}">
                <button class="btn_buy" type="submit">完成订单</button>
            </form>
        </td>
        <td>
            <form th:action="@{/order}" th:method="post">
                <input type="hidden" name="_method" value="DELETE">
                <input type="hidden" th:name="id" th:value="${order.id}">
                <input type="hidden" th:name="username" th:value="${order.username}">
                <button class="btn_delete" type="submit">删除</button>
            </form>
        </td>
    </tr>
    </tbody>
</table>
<p style="color: red" th:text="您还没有买东西呢....." th:if="${#strings.isEmpty(orders)}"></p>
</body>
</html>